package com.woniuxy.mq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class DirectMessageSender {


    @Autowired
    private AmqpTemplate template;  //用于发送消息的工具

    //负责向消息队列发送消息
    public void send(String msg){
        //参数一：消息队列
        //参数二：要发送的消息
        template.convertAndSend("wyqueue",msg);
    }


}
